Program Fakultaet;
{ Dies ist eine kleine Demo zu Rekursion }
Type T_Sieb = Array[500] of Boolean;

Var I,w  : Integer;  { Zur Demonstration lokal überdeckt global }
    Feld : T_Sieb;

Function Fac( I : Integer) : Integer;
Begin
 if i<=1
    then return(1)
    else return(I*(fac(i-1)))
End;

Procedure Init;
Var i : Integer;

Begin
 For i:=1 to 500 By 1 Do
   Feld[i]:=True
End;

Begin
 Write('Eingabe Nummer :');
 Readln(i);
 Writeln(' Fak(',i,')=',Fac(i));
 Writeln('Sieb init...');
 Init;
 Writeln('Siebe ...');
 For i:=2 to 250 By 1 DO
     Begin
       w:=i*2;
       While w<=500 Do
             Begin
               Feld[w]:=False;
               w:=w+i
             End
     End;
 Writeln('Primzahlen sind :');
 For i:=1 to 500 by 1 Do
     If Feld[i]
        then Write(I,'    ');
 Writeln;
 Write('Fertig ...');
 Readln
End.
